﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;

namespace INSA
{
    public partial class FormLogin : Form
    {
        private string passwd = "";

        public string Passwd
        {
            get { return passwd; }
            set { passwd = value; }
        }

        public FormLogin()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtPW.Text.Length == 0)
            {
                MessageBox.Show("비밀번호를 입력하세요!   ", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtPW.Focus();
                return;
            }

            if (DBUtil.checkPassword(txtPW.Text) == true)
            {
                this.AcceptButton = btnClose;
                
                btnClose.DialogResult = DialogResult.OK;
                
                btnClose.PerformClick();
            }
            else
            {
                MessageBox.Show("비밀번호가 일치하지 않습니다.   ", "확인", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtPW.Focus();
                return;
            }
        }

        private void txtPW_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                btnLogin.PerformClick();
            }
        }

        
    }
}
